import request from '@/utils/request'

// 查询发票列表
export function listInvoice(query) {
  return request({
    url: 'api/invoice/list-invoice',
    method: 'get',
    params: query
  })
}
// 修改发票
export function updateInvoice(data) {
  return request({
    url: 'api/invoice/editInvoice',
    method: 'post',
    data: data
  })
}

//查看某个订单是否已经开票
export function checkInvoice(orderId) {
  return request({
    url: 'api/invoice/is-invoice/' + orderId,
    method: 'get'
  })
}

//下载发票文件
export function downloadInvoice(fileName) {
  return request({
    url: 'common/download' ,
    method: 'get',
    params: {
      fileName: fileName,
    }
  })
}

export function addInvoice(data) {
  return request({
    url: 'api/invoice/apply-invoice',
    method: 'post',
    data: data
  })
}

//更改发票状态
export function updateInvoiceStatus(id) {
  return request({
    url: 'api/wallet-com/update-invoice-status' ,
    method: 'post',
    params: {
      dealId: id,
    }
  })
}
